package com.bclz.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bclz.bo.CommentBo;
import com.bclz.common.AbstracePage;
import com.bclz.common.base.AbstractBaseService;
import com.bclz.entity.User;
import com.bclz.mapper.CommentMapper;
import com.bclz.mapper.UserMapper;
import com.bclz.service.UserService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class UserSeviceImpl extends AbstractBaseService<User, UserMapper> implements UserService {

	@Autowired
	private CommentMapper commentMapper;
	
	@Override
	public User getbyOpenid(String openid) {
		// TODO Auto-generated method stub
		
		return mapper.getbyOpenid(openid);
	}

	@Override
	public PageInfo<CommentBo> selflistComment(String userId,AbstracePage page) {
		// TODO Auto-generated method stub
		Page<CommentBo> pageres=PageHelper.startPage(page.getPageNum(),page.getPageSize() , true);
		commentMapper.selflistComment(userId);
		PageInfo<CommentBo> info=new PageInfo<CommentBo>(pageres);
		return info;
	}

	@Override
	public PageInfo<CommentBo> selflistResponse(String userId,AbstracePage page) {
		// TODO Auto-generated method stub
		Page<CommentBo> pageres=PageHelper.startPage(page.getPageNum(),page.getPageSize() , true);
		commentMapper.selflistResponse(userId);
		PageInfo<CommentBo> info=new PageInfo<CommentBo>(pageres);
		return info;
	}

}
